Skip to content

Glasgow | 26- SDC-Mar | Taras Mykytiuk | Sprint 2 | Shell pipelines#418

Open
TarasMykytiuk wants to merge 3 commits into
CodeYourFuture:mainfrom
TarasMykytiuk:shell_pipelines
Open

Glasgow | 26- SDC-Mar | Taras Mykytiuk | Sprint 2 | Shell pipelines#418
TarasMykytiuk wants to merge 3 commits into
CodeYourFuture:mainfrom
TarasMykytiuk:shell_pipelines

Conversation

@TarasMykytiuk
Copy link
Copy Markdown

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

Shell pipelines exercises are done.

@TarasMykytiuk TarasMykytiuk added 📅 Sprint 2 Assigned during Sprint 2 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Module-Tools The name of the module. labels Mar 23, 2026
set -euo pipefail

# TODO: Write a command to output the names of the files in the sample-files directory whose name starts with an upper case letter.
ls sample-files | grep '\b[A-Z]'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\b won't work for filenames like abc.Xyz because . is considered a word boundary.

Hint: There is a regex symbol that matches "beginning of a string".

set -euo pipefail

# TODO: Write a command to output the names of the files in the sample-files directory whose name starts with an upper case letter and doesn't contain any other upper case letters.
ls sample-files | grep -w '[A-Z][a-z]*'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Filenames are listed one filename per line. -w option does not help.

  • Also, the regex should also work for filenames like A123.jpg, B$$$.txt.

Note: The same also apply to script-04.sh

Comment on lines +7 to +8
cat events.txt | grep 'Entry' | sort -u | wc -l | sed 's/$/ entries/'
cat events.txt | grep 'Exit' | sort -u | wc -l | sed 's/$/ exits/'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use only ONE command to produce an output in the form:

5 Entry
4 Exit

?

Hint: Extract the words in the first column first.

The same applies also to script-07.sh.


# The input for this script is the scores-table.txt file.
# TODO: Write a command to output scores-table.txt, with lines sorted by the person's first score, descending.
sort scores-table.txt -k3 -n -r
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Common practice is to specify options before the filename.

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Module-Tools The name of the module. Reviewed Volunteer to add when completing a review with trainee action still to take. 📅 Sprint 2 Assigned during Sprint 2 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants